package avicit.bdp.dms.prm.dto;

import avicit.bdp.common.base.BaseDTO;
import avicit.platform6.core.annotation.log.FieldRemark;
import avicit.platform6.core.annotation.log.Id;
import avicit.platform6.core.annotation.log.LogField;
import avicit.platform6.core.properties.PlatformConstant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;

import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.List;


/**
 * 标签表实体
 */
@ApiModel(value = "TagDTO", description = "标签表")
@Table(name = "bdp_prm_tag")
public class TagDTO extends BaseDTO {

    /**
     * 主键
     */
    @LogField
    @ApiModelProperty(value = "主键")
    @FieldRemark(column = "id", field = "id", name = "主键")
    @Column(name = "id")
    @Id
    @javax.persistence.Id
    private String id;

    /**
     * 名称
     */
    @LogField
    @ApiModelProperty(value = "名称")
    @FieldRemark(column = "name", field = "name", name = "名称")
    @Column(name = "name")
    private String name;
    /**
     * 编码
     */
    @LogField
    @ApiModelProperty(value = "编码")
    @FieldRemark(column = "code", field = "code", name = "编码")
    @Column(name = "code")
    private String code;
    /**
     * 是否分类  0-否 1-是
     */
    //@LogField
    @ApiModelProperty(value = "是否分类  0-否 1-是")
    //@FieldRemark(column = "category", field = "category", name = "是否分类  0-否 1-是")
    @Column(name = "category")
    private Integer category;
    /**
     * 是否末级节点 0-否 1-是
     */
    //@LogField
    @ApiModelProperty(value = "是否末级节点 0-否 1-是")
    //@FieldRemark(column = "leaf", field = "leaf", name = "是否末级节点 0-否 1-是")
    @Column(name = "leaf")
    private Integer leaf;
    /**
     * 是否默认展开 0-否 1-是
     */
    //@LogField
    @ApiModelProperty(value = "是否默认展开 0-否 1-是")
    //@FieldRemark(column = "unfolded", field = "unfolded", name = "是否默认展开 0-否 1-是")
    @Column(name = "unfolded")
    private Integer unfolded;
    /**
     * 父节点id
     */
    //@LogField
    @ApiModelProperty(value = "父节点id")
    //@FieldRemark(column = "parentId", field = "parentId", name = "父节点id")
    @Column(name = "parent_id")
    private String parentId;
    /**
     * 标签类型 从common type表获取
     */
    @LogField
    @ApiModelProperty(value = "标签类型 从common type表获取")
    @FieldRemark(column = "tagType", field = "tagType", name = "标签类型 从common type表获取")
    @Column(name = "tag_type")
    private String tagType;
    /**
     * 标签状态 0-停用 1-启用
     */
    @LogField
    @ApiModelProperty(value = "标签状态 0-停用 1-启用")
    @FieldRemark(column = "tagStatus", field = "tagStatus", name = "标签状态 0-停用 1-启用")
    @Column(name = "tag_status")
    private Integer tagStatus;
    /**
     * 备注
     */
    @LogField
    @ApiModelProperty(value = "备注")
    @FieldRemark(column = "remark", field = "remark", name = "备注")
    @Column(name = "remark")
    private String remark;
    /**
     *
     */
    //@LogField
    @ApiModelProperty(value = "")
    //@FieldRemark(column = "orderBy", field = "orderBy", name = "")
    @Column(name = "order_by")
    private Integer orderBy;

    @Transient
    private String createUser;

    @Transient
    private List<TagDTO> children;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Integer getCategory() {
        return category;
    }

    public void setCategory(Integer category) {
        this.category = category;
    }

    public Integer getLeaf() {
        return leaf;
    }

    public void setLeaf(Integer leaf) {
        this.leaf = leaf;
    }

    public Integer getUnfolded() {
        return unfolded;
    }

    public void setUnfolded(Integer unfolded) {
        this.unfolded = unfolded;
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public String getTagType() {
        return tagType;
    }

    public void setTagType(String tagType) {
        this.tagType = tagType;
    }

    public Integer getTagStatus() {
        return tagStatus;
    }

    public void setTagStatus(Integer tagStatus) {
        this.tagStatus = tagStatus;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Integer getOrderBy() {
        return orderBy;
    }

    public void setOrderBy(Integer orderBy) {
        this.orderBy = orderBy;
    }

    public String getCreateUser() {
        return createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    public List<TagDTO> getChildren() {
        return children;
    }

    public void setChildren(List<TagDTO> children) {
        this.children = children;
    }

    @Override
    public String getLogFormName() {
        if (StringUtils.isEmpty(super.logFormName)) {
            return "标签管理";
        } else {
            return super.logFormName;
        }
    }

    @Override
    public String getLogTitle() {
        if (StringUtils.isEmpty(super.logTitle)) {
            return "标签";
        } else {
            return super.logTitle;
        }
    }

    @Override
    public PlatformConstant.LogType getLogType() {
        if (super.logType == null) {
            return PlatformConstant.LogType.module_operate;
        } else {
            return super.logType;
        }
    }
}

